# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: FaziBear <fazibear@gmail.com>

pkgname=jruby
pkgver=9.4.2.0
pkgrel=1
pkgdesc="100% pure-Java implementation of the Ruby programming language"
url="https://www.jruby.org/"
arch=(any)
license=(EPL GPL2 LGPL2.1 custom)
options=(!strip)
source=(https://repo1.maven.org/maven2/org/jruby/jruby-dist/$pkgver/jruby-dist-$pkgver-bin.tar.gz)
md5sums=('486e50f3c74e7400e71631819fde91da')
sha1sums=('c338c1d3846e51b651e31e248097fdee4920056a')
sha256sums=('c2b065c5546d398343f86ddea68892bb4a4b4345e6c8875e964a97377733c3f1')

prepare() {
  cd jruby-$pkgver
  rm -rv bin/*.{bat,dll,exe} lib/jni/{Darwin,*-SunOS,*-Windows,*-AIX,*-*BSD}
  chmod -cR g-w .
}

package() {
  depends=(java-runtime-headless bash)

  mkdir -p "$pkgdir"/{opt,usr/bin,usr/share/licenses/$pkgname}
  cp -a jruby-$pkgver "$pkgdir/opt/jruby"
  ln -srt "$pkgdir/usr/bin" \
    "$pkgdir"/opt/jruby/bin/j{irb,irb_swing,gem,ruby,rubyc}
  install -Dt "$pkgdir/usr/share/licenses/$pkgname" -m644 jruby-$pkgver/COPYING
}
